package com.qianfeng.openplateform.search.rabbit;

import com.qianfeng.openplateform.search.bean.ESFieldBean;
import com.qianfeng.openplateform.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.stereotype.Component;

/**
 * @author 江江
 * @Date 2020/7/30 13:33
 */
@Component
@EnableBinding(LogsListenConsumer.class)
public class LogsRabbitListener {
    @Autowired
    private SearchService searchService;
    @StreamListener("logs-exchange")
    public void onMessage(ESFieldBean bean){
        searchService.saveLogsToEs(bean);

    }
}
